package com.superquan.selfstudybootmybatis.consts;

public interface Constant {
    // 用户相关常量
    public static class User {
        public static final String TOKEN_NAME = "token"; // header中使用的token名称
        public static final String CURRENT_USER = "currentUser"; // 当前登录用户

        public static final int LOGIN_RETRY_TIMES = 8; // 登录错误次数
    }

    // Redis Key
    public static class RedisKey {
        public static final String LOGIN_USER_PREFIX = "loginPwd_"; // 用于记录用户密码登录的次数
        public static final String LOGIN_SMS_PREFIX = "loginSms_"; // 用于记录用户短信登录的次数
        public static final int LOGIN_RETRY_WAIT = 60; // 登录错误次数过多需等待的时间(分钟)

        public static final String SMS_CODE_PREFIX = "smsCode_"; // 用于记录发送到手机的短信验证码
        public static final int SMS_CODE_EXPIRED = 10; // 短信验证码有效时间(分钟)

        public static final String PHONE_UUID_PREFIX = "phoneUuid_"; // 手机uuid
        public static final int PHONE_UUID_EXPIRED = 1; // 发送 短信验证码时间间隔(分钟)
        public static final String SMS_UUID_PREFIX = "smsUuid_"; // 用于记录手机发送短信次数
        public static final int SMS_UUID_EXPIRED = 60; // 手机发送短信次数过多需等待的时间(分钟)

        public static final String PHONE_USER = "phoneUser"; // hash所有用户，按手机号phone查找userid
        public static final String WECHAT_ID = "wechatId"; // hash 所有用户，按微信unionId查找userid
        public static final String SYS_USER = "sysUser"; // hash 所有用户， 按userid查找用户对象
        /**
         * token和ECC秘钥对的生命周期
         */
        public static final long TIME_OUT = 7200;
    }

    //用户登录注册相关常量
    public static class ResponseCode{
        public static final String SYSTEM_OPERATION_EXCEPTION="系统操作异常！";//一般是用于提醒用户输入的用户名密码等为空 或者是后台处理异常
        public static final String INVALID_PHONE_NUMBER="手机格式不正确，请重新输入！";//手机号格式不正确
        public static final String INVALID_USER_NAME="用户名格式不正确，请重新输入！";//用户名格式不正确
        public static final String INVALID_PASSWORD="密码格式不正确，请重新输入！";//密码号格式不正确
        public static final String USER_NAME_ALREADY_REGISTERED="该用户名已被注册，请更换用户名";//用户名已被注册
        public static final String PHONE_NUMBER_ALREADY_REGISTERED="该手机号已被注册，请更换手机号";//手机号已被注册
        public static final String PHONE_NUMBER_NO_REGISTERED="手机号不存在";//手机号未被注册
        public static final String REDIS_KEY_REGISTER_CODE_TEMPLATE = "cim:register:";//短信验证码两分钟之内有效存入redis的key的前缀
        public static final String REDIS_KEY_MSGVALID = "cim:msgvalid:";//发送短信间隔一分钟存入redis的key的前缀
        public static final String REDIS_KEY_ECC_ON_ACCOUNT="cim:accountlogin:";
        public static final String REDIS_KEY_ECC_ON_PHONE="cim:phonelogin:";
        public static final String ERROR_COUNT = ":errorCount";//登录错误统计
        public static final String TOKEN = ":token";
        public static final int PHONE_CODE_TIME_OUT = 120;//短信验证码两分钟之内有效
        public static final  int PHONE_MSG_SENDTIME = 60;//短信发送时间间隔为一分钟
        public static final long ERROR_COUNT_TIME_OUT = 3600;//登录密码错误超过五次，限制登录一小时
        public static final String FAILED_TO_SEND_VERIFICATION_CODE="短信验证码发送失败！";
        public static final String VERIFICATION_CODE_SEND_SUCCESSFULLY="验证码生成成功！";
        public static final String CACHE_SAVE_FAILED="缓存保存失败";
        public static final String INVALID_VERIFICATION_CODE="验证码无效！";//验证码可能为null
        public static final String VERIFICATION_CODE_ERROR="输入验证码有误，请重新输入！！";//输入的验证码不正确
        public static final String USERNAME_PASSWORD_ERROR="用户名或密码错误！";//用户名或密码错误！
        public static final String LOGIN_BY_ACCOUNT="ACCOUNT";//用户名密码登录
        public static final String LOGIN_BY_PHONE="PHONE";//手机号登录
        public static final Integer LOGIN_ERROR_COUNT = 5;//登录失败次数
        public static final String LOGIN_RESTRICTION="次数超过5次，请1小时后尝试！";
        public static final String USER_DISABLED="登录失败，用户被禁用或已被删除！";

    }

    //正则表达式相关常量
    public static class RegularExpressionConstant{
        public static final String REGULAR_PHONE="^1([38]\\d|5[0-35-9]|7[3678])\\d{8}$";//手机号格式验证
        public static final String REGULAR_EMAIL="^(\\w-*\\.*)+@(\\w-?)+(\\.\\w{2,})+$";//邮箱格式验证
        public static final String ROLE_NAME="[\\u4E00-\\u9FA5·]+";
        public static final String REGULAR_USERNAME="^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,12}$";//用户名格式验证(长度6-12位，数字加字母)
        public static final String REGULAR_PASSWORD="^(?![a-zA-z]+$)(?!\\d+$)(?![!@#$%^&*]+$)(?![a-zA-z\\d]+$)(?![a-zA-z!@#$%^&*]+$)(?![\\d!@#$%^&*]+$)[a-zA-Z\\d!@#$%^&*]{8,16}$";//密码格式验证(长度8-16位，数字加字母加特殊符号)
    }

    // 非对称加密的公钥私钥
    public static class RSA {
        public static final String PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+yiMp1uZJswL2oe89+71WSaEPOiqZdzwUzwwsxkXYiRmU1P70345TsjkQYJUc32EGSdWp3P19ujziUfEOTDT1ynNTElDB+i/IYXptTnsF+asql3+qe370VtttPYoM8FHo75WNar8CkrIp6S5Fw2lD0DYoY/36JkhxIWc/R+brtQIDAQAB";
        public static final String PRIVATE_KEY = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAL7KIynW5kmzAvah7z37vVZJoQ86Kpl3PBTPDCzGRdiJGZTU/vTfjlOyORBglRzfYQZJ1anc/X26POJR8Q5MNPXKc1MSUMH6L8hhem1OewX5qyqXf6p7fvRW2209igzwUejvlY1qvwKSsinpLkXDaUPQNihj/fomSHEhZz9H5uu1AgMBAAECgYEAqbW0ware/f+2SxyQa1paeT7VfW4IJqrhTsE92zYjOxH5J2Kvx7J0MA8Ao4jGGwC4lZdn78kb05KuRcMN4eH32IDnoX8jTHugbtPY3qSlOMHM1Dn4GodTZfYzXUzQWPajAdbyRmWFx/VRUSYeX+CFhmMcQyGLhXMwG+RZniDXcAECQQDvXXlvtGqyh47Zm2P/PbjaSMwmV4uzuwN7VttF4/mum5tw5/F3jSRBA+jYK6zvNDU/NsZhV8gTOHcEIA7UeRqBAkEAzAx1qFnkZ/TDt6+ZN51Ka/sFotAh39bab9XZG2MpCtroPRIGgNwo44EMF173ICMKGho7D0RlKSKrt6el9BbvNQJAUMlknf3vcPftj6Yxdsj3Jb0iIeK0ROHeh/dFpG4QLA1axh2SUr4xOTw/jw4WnNkrC33KMLp2zX3mNV84gh+pgQJAfMBRXvA2mOgokLEnN71Ott3uADDHxRaSzjUsW3YwrZZQzqWqnDX+Obm4LsG8zUUe8/59hUQHpTKxUcOJzsYG0QJBANhJWD9/smTTdnF3B4eTQ47NaKRjtoGw/tp6nDL80EYH/mvdvJn9gLEZKOgaLl1CYg4PpaLRnmJ7R7gDuq5vtGA=";
    }

    //公共类
    public static class Common {
        public static final String CHAR_SET_UTF8 = "UTF-8";
        public static final String CHAR_SET_GBK = "GBK";

    }

}
